<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<%@ taglib uri="/secu" prefix="secu"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>欢迎访问产品运营互动中心！</title>
<script type="text/javascript"
	src="<s:url value="/script/easyajax.js"/>"></script>

		<link rel="stylesheet" href="<s:url value="/css/style_new.css"/>">
		<link href="<s:url value="/images/08_ccxxzx.css"/>" rel="stylesheet"
			type="text/css" />

		<script language="javascript">
</script>
		<script type="text/javascript"
			src="<s:url value="/script/sysOper.js"/>"></script>
		<script type="text/javascript"
			src="<s:url value="/components/datepicker/WdatePicker.js"/>"></script>
<script>
function addProduct(){//产品目录下新增产品
	form2.action="<s:url value="/business/product/su_editProduct.action" />";
	form2.submit();
}
function addSort(){//产品子目录新增\
    form1.submit();
}
function deleteSort(sortId){
    var ind=event.srcElement.parentElement.parentElement.rowIndex;
	if(!confirm('您正在删除产品目录信息，是否确认删除?')){
		return;
	}
	var url="su_delProductSort.action?productSort.id="+sortId;
	
	callSynchronized(url,function(XML){//同步调用
	    var ajax=new AjaxObj();
	    if($$(XML.responseXML,"str")=="true"){
	        singleSortTable.deleteRow(ind);
	    	alert("删除成功!");
	    }else{
	    	alert("删除失败!");
	    }
	});
}
function deleteProduct(productId){
	var ind=event.srcElement.parentElement.parentElement.rowIndex;
	if(!confirm('您正在删除产品目录下产品信息，是否确认删除?')){
		return;
	}
	var url="<s:url value="/business/product/su_delProduct.action?product.id=" />"+productId;
	callSynchronized(url,function(XML){//同步调用
	    var ajax=new AjaxObj();
	    if($$(XML.responseXML,"str")=="true"){
	        singleProductTable.deleteRow(ind);
	    	alert("删除成功!");
	    }else{
	    	alert("删除失败!");
	    }
	});
}
function editProduct(producId){
    form2.action="<s:url value="/business/product/su_editProduct.action" />?product.id="+producId;
	form2.submit();
}
</script>
	</head>
	<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"  method="post">
		<TABLE width="98%" cellSpacing=1 cellPadding=0 align="center">
			<TR height=30>
				<TD align=left width="10%">
				<secu:out resType="MODELMENU" code="CATALOGMANAGE">
					<input type="button" name="new" value="新增目录" onClick="addSort()">
				</secu:out>
				</TD>
			</TR>
		</table>
		<table width="98%" border="0"
			id="singleSortTable" cellspacing="0" cellpadding="7" align="center"
			class=tablecolor2>
			<tr>
				<td bgcolor="9AC2EB" jtext="name">
					<div align="center">
						<font color="#FFFFFF">目录名称 </font>
					</div>
				</td>
				<td bgcolor="9AC2EB" width="60px" jtext="sortType">
					<div align="center">
						<font color="#FFFFFF">目录类型 </font>
					</div>
				</td>
				<td bgcolor="9AC2EB" width="60px" jtext="creator">
					<div align="center">
						<font color="#FFFFFF">创建人</font>
					</div>
				</td>
				<secu:out resType="MODELMENU" code="CATALOGMANAGE">
				<td bgcolor="9AC2EB" width="100px">
					<div align="center">
						<font color="#FFFFFF">操作</font>
					</div>
				</td>
				</secu:out>
			</tr>
			<s:iterator value="productSorts">
				<tr>
					<td>
						<div align="center">
							<a href="su_editProductSort.action?productSort.id=${id}"><s:property value="name" /></a>
							
						</div>
					</td>
					<td>
						<div align="center">
							<s:if test="sortType==2">福建省产品分类</s:if>
							<s:elseif test="sortType==1">集团产品分类</s:elseif>
						</div>
					</td>
					<td>
						<div align="center">
							<s:property value="creator" />
						</div>
					</td>
				<secu:out resType="MODELMENU" code="CATALOGMANAGE">
					<td width="100px">
							<a href="su_editProductSort.action?productSort.id=${id}">编辑</a>
							<a onclick="deleteSort('${id}')" href="javascript:">删除</a>
							<a href="../product/su_findById.action?productRefSort.sort=${id}&parentSort=${parentProductSort.id}">产品</a>
					</td>
				</secu:out>
				</tr>
			</s:iterator>
		</table>
		<TABLE width="98%" cellSpacing=1 cellPadding=0 align="center">
			<TR height=30>
				<TD align=left width="10%">
      <secu:out resType="MODELMENU" code="PRODUCTMANAGE">
					<input type="button" name="new" value="新增产品"  onClick="addProduct()">
      </secu:out>
				</TD>
			</TR>
		</table>
		<table width="98%" id="singleProductTable" border="0" cellspacing="0" cellpadding="7"
			align="center" class=tablecolor2>
			<tr>
				<td bgcolor="9AC2EB" width="">
					<div align="center">
						<font color="#FFFFFF">产品名称 </font>
					</div>
				</td>
				<td bgcolor="9AC2EB" width="60px">
					<div align="center">
						<font color="#FFFFFF">创建时间</font>
					</div>
				</td>
				<td bgcolor="9AC2EB" width="60px">

					<div align="center">
						<font color="#FFFFFF">创建人</font>
					</div>
				</td>
				<td bgcolor="9AC2EB" width="100px">
					<div align="center">
						<font color="#FFFFFF">操作</font>
					</div>
				</td>
			</tr>
			<s:iterator value="products">
				<tr>
					<td>
						<div align="center">
							<a href="javascript:editProduct('${id}')">
							<s:property value="name" />
							</a>
						</div>
					</td>
					<td>
						<div align="center">
							<s:date name="begin" format="yyyy-MM-dd" />
						</div>
					</td>
					<td>
						<div align="center">
							<s:property value="creator" />
						</div>
					</td>
					<td>
						<div align="center">
						<s:if test="prodSet.contains(id)">
							<a href="javascript:editProduct('${id}')">
								编辑
							</a>
							<a href="javascript:void(0);" onclick="deleteProduct(${product.id});">删除</a>
						</s:if>
						<s:else>
							<a href="javascript:editProduct('${id}')">
								查看
							</a>
						</s:else>
						</div>
							<!--a href="javascript:"
								onclick="deleteProduct('${id}')">删除</a-->
					</td>
				</tr>
			</s:iterator>
		</table>
		<s:form action="su_editProductSort.action"   id="form1"  method="post"   enctype="multipart/form-data" >
			<input type="hidden" name="productSort.parentSort" value="${parentProductSort.id}"/>
			<input type="hidden" name="productSort.parentName" value="${parentProductSort.name}"/>
			<input type="hidden" name="productSort.sortType" value="${parentProductSort.sortType}"/>
		</s:form>
		<s:form action="/business/product/su_editProduct.action"   id="form2"  method="post"   enctype="multipart/form-data" >
			<input type="hidden" name="productSort.id" value="${parentProductSort.id}"/>
		</s:form>
	</body>
	<script>
function deleteProduct(productId){
	var ind=event.srcElement.parentElement.parentElement.rowIndex;
	if(!confirm('您正在删除产品目录下产品信息，是否确认删除?')){
		return;
	}
	var url="<s:url value="/business/product/su_delProduct.action?product.id=" />"+productId;
	callSynchronized(url,function(XML){//同步调用
	    var ajax=new AjaxObj();
	    if($$(XML.responseXML,"str")=="true"){
	        singleProductTable.deleteRow(ind);
	    	alert("删除成功!");
	    }else{
	    	alert("删除失败!");
	    }
	});
}
</script>
</html>

